<!DOCTYPE html>
<html>
<head>
    <title>Edit Student</title>
</head>
<body>
    <h1>Edit Student</h1>
    <form id="editStudentForm">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" value="{{ student[1] }}" required><br>
        <label for="grade">Grade:</label>
        <input type="text" id="grade" name="grade" value="{{ student[2] }}" required><br>
        <input type="hidden" id="id" name="id" value="{{ student[0] }}">
        <input type="submit" value="Save">
    </form>

    <script>
    $("#editStudentForm").submit(function(e) {
        e.preventDefault();
        var formData = $(this).serialize();
        $.post('/edit_student/{{ student[0] }}', formData, function(data) {
            location.href = '/student_management';
        });
    });
    </script>
</body>
</html>